<template>
  <div class="top b_color">
    <div class="icon" @click="toShow">
      <el-icon color="#fff"><ArrowLeftBold /></el-icon>
    </div>
    <div>核销</div>
    <div class="icon">
      <el-icon><Setting /></el-icon>
    </div>
  </div>
  <div class="body">
    <div class="input">
      <el-input
        v-model="code"
        style="width: 100%; height: 100%"
        placeholder="输入要核销的订单号"
        clearable
      />
    </div>
    <div class="button" @click="confirm">
      <el-button style="width: 60%; height: 50px; color: #fff" class="b_color"
        >确认</el-button
      >
    </div>
  </div>
</template>
<script setup>
import { ref } from "vue";
import { ElNotification } from "element-plus";
import http from "@/api/index.js";

const emit = defineEmits(["onClose"]);
let code = ref("");
let toShow = () => {
  code.value = "";
  emit("onClose", { show: false });
};

const confirm = async () => {
  var params = {
    code: code.value,
  };
  if (code.value) {
    var result = await http.cav({ params })

    if (result.data.status == 1) {
      ElNotification({
        title: "成功",
        message: result.data.message,
        type: "success",
        duration:2500
      })
    }else {
      ElNotification({
        title: "错误",
        message: result.data.message,
        type: "error",
        duration:2500
      });
    }
  }
};
</script>
<style scoped>
@import "@/assets/css/common.css";
@import "@/assets/css/order/hexiao.css";
</style>